﻿<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<M:GoogleApiKey/>&amp;hl=<M:LocalCulture/>" type="text/javascript"></script>
<script src="<M:ScriptUrl/>" type="text/javascript"></script>

<script type="text/javascript">
//<![CDATA[
    function showAddress(sMapName) {
        var oGeocoder = new GClientGeocoder();
        var oMap = document.getElementById(sMapName);
        var oSearchBox = document.getElementById(sMapName + '_searchBox');
        var sAddress = oSearchBox.value;
        oGeocoder.getLatLng(sAddress, function(point) {
            if (!point)
                alert("<M:LNGNotFound/>" + "'" + sAddress + "'");
            else
                oMap.setCenter(point, 13);
        });
    }
//]]>      
</script>

<C:ShowSearchBox>
<div>
  <input id="<M:MapObjectName/>_searchBox" maxlength="100" name="<M:MapObjectName/>_searchBox" type="text" />
  <input onclick="showAddress('<M:MapObjectName/>')"
    type="button" value="<M:LNGSearch/>" />
</div>
</C:ShowSearchBox>

<div id="<M:MapObjectName/>" style="width: <M:MapWidth/>; height: <M:MapHeight/>;">
</div>

<script type="text/javascript">
//<![CDATA[
function loadMap() {
  if (GBrowserIsCompatible == null) {
    alert('<M:LNGGoogleServerNotFound/>');
  } else {
    if (window.addEventListener) {
      window.addEventListener('unload', GUnload, false);
    } else {
      if (window.attachEvent) {
        window.attachEvent('onunload', GUnload);
      } else {
        window.onunload = 'GUnload';
      }
    }  
    
    if (GBrowserIsCompatible()) {
      var <M:MapObjectName/> = new GMap2(document.getElementById("<M:MapObjectName/>"));
      
      <M:MapObjectName/>.rptLoadingControl.Left = <M:MapObjectName/>.getSize().width / 2;
      <M:MapObjectName/>.rptLoadingControl.ImageSrc = '<M:LoadingImage/>';
      
      <C:IsSmallMapControlEnabled><M:MapObjectName/>.rptControls.push(new GSmallMapControl());</C:IsSmallMapControlEnabled>
      <C:IsLargeMapControlEnabled><M:MapObjectName/>.rptControls.push(new GLargeMapControl());</C:IsLargeMapControlEnabled>
      for(var i = 0; i < <M:MapObjectName/>.rptControls.length; i++)
        <M:MapObjectName/>.addControl(<M:MapObjectName/>.rptControls[i]);
      
      <M:MapObjectName/>.setCenter(new GLatLng(<M:CentralLatitude/>, <M:CentralLongitude/>), <M:Zoom/>);
      <C:EnableGoogleBar><M:MapObjectName/>.enableGoogleBar();</C:EnableGoogleBar>
      
      <M:MapObjectName/>.rptInitialize();
      <M:Code/>
    }
  }
}

if (window.addEventListener) {
  window.addEventListener('load', loadMap, false);
} else {
  if (window.attachEvent) {
    window.attachEvent('onload', loadMap);
  } else {
    window.onload = 'loadMap';
  }
}

//]]>
</script>